#ifndef NET_H
#define NET_H

#ifdef __cplusplus  
extern "C" {  
#endif  

#include "wrk_core_t.h"

typedef enum {
    OK,
    ERROR,
    RETRY
} socket_status_t;

struct sock {
    socket_status_t ( *connect)(wrk_core_connection_t *, char *);
    socket_status_t (   *close)(wrk_core_connection_t *);
    socket_status_t (    *read)(wrk_core_connection_t *, size_t *);
    socket_status_t (   *write)(wrk_core_connection_t *, char *, size_t, size_t *);
    size_t (*readable)(wrk_core_connection_t *);
};

socket_status_t sock_connect(wrk_core_connection_t *, char *);
socket_status_t sock_close(wrk_core_connection_t *);
socket_status_t sock_read(wrk_core_connection_t *, size_t *);
socket_status_t sock_write(wrk_core_connection_t *, char *, size_t, size_t *);
size_t sock_readable(wrk_core_connection_t *);

#ifdef __cplusplus  
}
#endif 

#endif /* NET_H */
